home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
asmexam.arc
/
ASCBIN1.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-07-05
|
2KB
|
86 lines
page 55,80
title test program
cseg segment
assume cs:cseg,ds:cseg
decnum: db '123','zzzz' ; z's are for extra locations
org 100h
main:
lea si,decnum
jmp decbin
back: int 20h
decbin:
xor cx,cx
xor dx,dx
mov bx,-1
mov al,[si]
cmp al,'+'
jne decbin1
inc si
jmp decbin2
decbin1:
cmp al,'-'
jne decbin2
xor bh,bh
inc si
decbin2:
lodsb
or al,al
jz decbin8
cmp al,'.'
jz decbin4
cmp al,'9'
ja decbin7
cmp al,'0'
jb decbin7
or bl,bl
js decbin3
inc bl
decbin3:
push ax
mov di,cx
mov ax,dx
shl cx,1
rcl dx,1
shl cx,1
rcl dx,1
add cx,di
adc dx,ax
shl cx,1
rcl dx,1
pop ax
and ax,0fh
add cx,ax
adc dx,0
jmp decbin2
decbin4:
or bl,bl
jns decbin7
xor bl,bl
jmp decbin2
decbin7:
stc
jmp back
decbin8:
or bh,bh
jnz decbin9
not cx
not dx
add cx,1
adc dx,0
decbin9:
clc
jmp back
cseg ends
end main